=begin pod

=TITLE role Encoding

=SUBTITLE ...

    role Encoding { ... }

The C<Encoding> role is implemented by objects that provide a character
encoding, such as ASCII or UTF-8. Besides being implemented by the built-in
character encodings, it may also be implemented by users to provide new
encodings. Instances of objects doing this role are typically obtained using
C<Encoding::Registry>. For a list of supported encodings, see L<IO::Handle|/type/IO::Handle#method_encoding>

=head1 Methods

=head2 method name

    method name(Encoding:D: --> Str)

Gets the primary name of the encoding.

=head2 method alternative-names

    method alternative-names(Encoding:D: --> List)

Gets a list of alternative names for the encoding.

=head2 method decoder

    method decoder(Encoding:D: *%options --> Encoding::Decoder)

Gets a character decoder instance for this encoding, configured with the
provided options. Options vary by encoding. The built-in encodings all
support C<translate-nl>, which if C<True> will translate C<\r\n> into
C<\n> while decoding.

=head2 method encoder

    method encoder(Encoding:D: *%options --> Encoding::Encoder)

Gets a character encoder instance for this encoding, configured with the
provided options. Options vary by encoding. The built-in encodings all support
both C<replacement> (either a C<Str> replacement sequence or C<True> to use a
default replacement sequence for unencodable characters) and C<translate-nl>
(when set to C<True>, turns C<\n> into C<\r\n> if the current platform is
Windows).

=end pod

# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
